<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<link href="/include/css/admin.css" rel="stylesheet" type="text/css">
<title>文章管理页面</title>
<script language="JavaScript" src="/include/js/forbidNew.js" type="text/JavaScript"></script>
<script language="JavaScript">
function doSave()
{
EditForm.displaytime.value=getDisplayTime();
//alert(EditForm.displaytime.value);
if(doCheck())
{
if(EditForm.cid.value!="")EditForm.parameter.value="update";
EditForm.content.value=htmlEdit.getHTML();
EditForm.submit();
}
}
function getDisplayTime()
{
var year,month,day,hour,minute;
var d=new Date();
if(EditForm.displayYear.value=="")
year=d.getYear();
else year=EditForm.displayYear.value;
if(EditForm.displayMonth.value=="")
month=d.getMonth()+1;
else month=EditForm.displayMonth.value;
if(EditForm.displayDay.value=="")
day=d.getDay()+1;
else day=EditForm.displayDay.value;

if(EditForm.displayHour.value=="")
hour=d.getHours();
else hour=EditForm.displayHour.value;

if(EditForm.displayMinute.value=="")
minute=d.getMinutes();
else minute=EditForm.displayMinute.value;
return year+"-"+month+"-"+day+ " "+hour+":"+minute+":0";
}
function doDel()
{
if(EditForm.cid.value!="")
{
EditForm.parameter.value="del";
EditForm.submit();
}
}
function doCheck()
{
if(EditForm.title.value=="")
{
alert("标题不能为空!");
EditForm.title.focus();
return false;
}
return true;
}
function doUpload(obj,upFrame,types)
{
upFrame.EditForm.subCommand.value="NewsContent";
if(upFrame.EditForm.file.value!="")
{
upFrame.EditForm.parentObj.value=obj.name;
upFrame.EditForm.types.value=types;
upFrame.EditForm.submit();
}
}
function addAttach(type,value)
{
//alert(obj.value);
var obj;
if(type=="imgs")obj=EditForm.imgs;
else obj=EditForm.files;
if(obj.value.indexOf(value)<0)
{
if(obj.value!="")obj.value+=","+value;
else obj.value=value;
}
}
function addOptions(obj,value,text)
{
alert(value);
var sel=eval("EditForm."+obj);
for(var i=0;i<sel.options.length;i++)
{
if(sel.options[i].text==text)sel.options[i]=null;
}
var it=new Option(text,value);
sel.options[sel.options.length]=it;
}
function insertImgs()
{
//alert(EditForm.imgsSelect.value);
var imgPath=EditForm.imgsSelect.value;
htmlEdit.insertHTML("<img src='/upfile/"+imgPath+"' border=0>");
}
function init()
{
setSelectValue(EditForm.displayYear,1999,2008);
setSelectValue(EditForm.displayMonth,1,12);
setSelectValue(EditForm.displayDay,1,31);
setSelectValue(EditForm.displayHour,1,24);
setSelectValue(EditForm.displayMinute,1,60);		
window.setTimeout('initValue()',500);
}
function initValue()
{
		htmlEdit.setHTML(contentSpan.innerHTML);					
		if(EditForm.displaytime.value!="")
		{		
		var s=EditForm.displaytime.value.split("-");
		EditForm.displayYear.value=s[0];
		EditForm.displayMonth.value=s[1];
		EditForm.displayDay.value=s[2];
		EditForm.displayHour.value=s[3];
		EditForm.displayMinute.value=s[4];
		}
}
function setSelectValue(sel,begin,end)
{
sel.options.length=1;
for(var i=begin,j=1;i<=end;i++,j++)
{
var op=new Option(i,i);
sel.options[j]=op;
}
}
function changeDetailSetting()
{
detailSetting.style.display=(detailSetting.style.display=="none"?"":"none");
}
</script>
</head>
<body onLoad="init();">
<table width="99%"  border="0" cellpadding="0" cellspacing="0" bgcolor="#FFFFFF">
	<tr>
		<td height="38" align="center" valign="bottom"><table width="96%" height="34"  border="0" cellpadding="0" cellspacing="0">
				<tr>
					<td valign="middle"><table width="53%"  border="0" cellspacing="0" cellpadding="0">
							<tr>
								<td width="10%" valign="bottom"><img src="/images/system/ico/newsDir.jpg" width="32" height="32"></td>
								<td width="90%" class="titletxt">编辑博客文章</td>
							</tr>
						</table></td>
					<td width="100">&nbsp;</td>
					<td width="120">&nbsp;</td>
				</tr>
			</table></td>
	</tr>
	<tr>
		<td height="40" align="center" valign="middle"><table width="96%" height="100%"  border="0" cellpadding="0" cellspacing="0" class="toolTable">
				<tr>
					<td width="5">&nbsp;</td>
					<td width="55" align="left" valign="middle"><input type="submit" name="Submit" value="保存" onClick="doSave();" class="colorButton"></td>
					<td width="55" align="left" valign="middle"><input type="submit" name="Submit2" value="删除" onClick="doDel();" class="colorButton"></td>
					<td width="55" valign="middle"><input type="submit" name="Submit3" value="返回" onClick="history.go(-1)" class="colorButton"></td>
					<td width="27" valign="middle">&nbsp;</td>
					<td width="28" valign="middle">&nbsp;</td>
					<td width="55" valign="middle">&nbsp;</td>
					<td valign="middle">&nbsp;</td>
				</tr>
			</table></td>
	</tr>
	<tr>
		<td align="center" valign="top"><form id="EditForm" name="EditForm" method="post" action="/blogNewsDoc.do">
				<input type="hidden" name="parameter" value="add">
				<input type="hidden" name="cid"   value="$!cid">
				<input type="hidden" name="displaytime"  value="$!CommUtil.formatDate('yyyy-M-d-H-m',$!displaytime)">
				<table width="96%"   border="0" cellpadding="1" cellspacing="0">
					<tr  >
						<td width="73" height="23" align="right">标 题</td>
						<td colspan="3"><font color="#FF0000">
							<input name="title" type="text" id="title" value="$!title" style="width:80%">
							*</font></td>
					</tr>
					<tr>
						<td width="73" height="23" align="right">频 道</td>
						<td width="188" align="left"><select name="dirSn">
								<option value="">请选择</option>
								              $!TagUtil.options($dirService.queryBlogNewsDir($currentUser.userName,1,15).result,"cid","title",$dirSn)	   
            
							</select>
							<select id="circlesn" name="circlesn">
								<option value="">发表到圈子</option>
								
			$!TagUtil.options($circleService.queryAllUserCircle($currentUser.userName).result,"cid","title",$circlesn)
		    
							</select></td>
						<td width="52" align="right">显示时间</td>
						<td width="418" align="left"><select name="displayYear">
								<option value="">选择</option>
							</select>
							年
							<select name="displayMonth">
								<option value="">选择</option>
							</select>
							月
							<select name="displayDay">
								<option value="">选择</option>
							</select>
							日
							<select name="displayHour">
								<option value="">选择</option>
							</select>
							时
							<select name="displayMinute">
								<option value="">选择</option>
							</select>
							分</td>
					</tr>
					<tr >
						<td  width="73" align="right">来 源</td>
						<td colspan="3"><font color="#FF0000">
							<input name="source" type="text" id="source" value="$!source" style="width:80%">
							</font></td>
					</tr>
					<tr >
						<td width="73"align="right" valign="top">内 容<br>
							<br>
							查看源码
							<input type="checkbox" name="checkbox" value="checkbox" onClick="htmlEdit.changeMode()">
							<br></td>
						<td colspan="3"><textarea name="content" rows="2" class="smallInput" style="width:100%;display:none"></textarea>
							<span id="contentSpan" style="display:none">$!content</span>
							<iframe id='htmlEdit' name='htmlEdit' width="100%" height="400" src="/include/js/htmlEdit.htm"></iframe>
							<span id="htmlTempSpan" style="display:none"></span></td>
					</tr>
					<tr >
						<td colspan="4" ><a href="javascript:void(0)" onClick="changeDetailSetting()"><font color="#0000CC">显示详细选项&gt;&gt;</font></a> &nbsp;&nbsp;&nbsp;&nbsp;</td>
					</tr>
					<tr >
						<td colspan="4"  align="right" class="formLable" ><table width="100%"  border="1" id="detailSetting" style="display:none">
								<tr >
									<td  width="60"  align="right" class="formLable">文章简介</td>
									<td colspan="3"    class="formText"><textarea name="intro" rows="3" class="smallInput" id="textarea" style="width:100%">$!intro</textarea ></td>
								</tr>
								<tr >
									<td width="60"  align="right" class="formLable">审核</td>
									<td    class="formText"><table width="100%"  border="0" height="100%">
											<tr>
												<td><input type="checkbox" name="auditing"  value="1" #if($!isauditing) checked #end></td>
												<td class="formLable">推荐</td>
												<td><input name="selected" type="checkbox" value="1" #if($!isselected) checked #end></td>
												<td><span class="formLable">作者</span></td>
												<td><input name="author" type="text" value="$!author" size="8"></td>
												<td class="formLable">评论</td>
												<td><input type="radio" name="radiobutton" value="radiobutton">
													允许
													<input type="radio" name="radiobutton" value="radiobutton">
													不允许匿名
													<input type="radio" name="radiobutton" value="radiobutton">
													禁止</td>
											</tr>
										</table></td>
									<td align="right"   class="formLable">直接跳转URL</td>
									<td    class="formText"><input name="url" type="text" id="url" value="$!url" size="20" ></td>
								</tr>
								<tr >
									<td width="60" align="right" class="formLable">图片</td>
									<td height="20" colspan="3"    class="formText"><table width="100%"  border="0">
											<tr>
												<td width="42%"><input name="imgs" type="text" id="imgs" style="width:100%" value="$!imgs"></td>
												<td width="6%" class="formLable">附件</td>
												<td width="42%"><input name="files" type="text" id="files" style="width:100%" value="$!files"></td>
											</tr>
										</table></td>
								</tr>
								<tr >
									<td width="60"  align="right" class="formLable">文章类型</td>
									<td height="20" colspan="3"    class="formText"><table width="100%"  border="0">
											<tr>
												<td><select name="types">
														
                    
                  $!typesOptions                 
              
                  
													</select></td>
												<td align="right">文章状态
													<select name="status">
														       
                
                  $!statusOptions
                       
                  
													</select></td>
												<td align="right"><span class="formLable">录入人</span></td>
												<td>$!inputuser</td>
												<td align="right">录入时间</td>
												<td>$!inputtime</td>
											</tr>
										</table></td>
								</tr>
							</table></td>
					</tr>
				</table>
			</form></td>
	</tr>
</table>
</body>
</html>
#if ($msg)
<script>
alert('$!msg');</script>
#end